Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve ARM Mac Path Check #1947

Merged
merged 3 commits into from
Sep 17, 2024
Merged

Conversation

nagilson
Copy link
Member

@nagilson nagilson commented Sep 11, 2024

Just as #1932 automerged I got some help getting a Mac.

Here is the conclusion:
VS Code runs on an emulated version of node which will return x64 or use x86 emulation for ARM devices.
os.arch() returns the architecture of the node binary, not the system architecture, so it will not report arm on an arm device.

This is why I've added the additional check below using uname which will report the correct architecture that's not being emulated on.

uname is a bit costly so we don't need to use it everywhere. Btw, if this command fails because someone removed uname from their system, it will just use the existing fallback logic, which is why I've kept it in place. (Believe me, people do some weird system alterations like that...)

Final note:

The .NET SDK can be not under emulation when node is. That is an important caveat, even though all installs this extension makes will be under emulation since node will be, that does not mean existing installs from other sources will be. We can deal with this by checking if the path exists, if we'd expect it to exist when looking for existing installs.

@nagilson nagilson force-pushed the nagilson-better-path-check branch from 4a25adb to 117b981 Compare September 11, 2024 16:52
@nagilson
Copy link
Member Author

nagilson commented Sep 11, 2024

Actually, while node being on emulation does mean sdks installed by our extension will be using this PATH, this does not mean that other sdks from other sources will be installed using the x64 emulation. I don't really like this change. We'd have to condition it nonetheless based on the same check that was already there, so it does not add much value.

Edit: we can condition this check so its actually ok :)

@nagilson nagilson requested a review from a team September 13, 2024 00:10
@nagilson nagilson merged commit 82b6a04 into dotnet:main Sep 17, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants